import request from '@/utils/request';

export function login({ username, password }) {
  return request({
    url: '/admin/login/doLogin',
    method: 'post',
    params: {
      username,
      password,
    },
  });
}

export function register({ username, password }) {
  return request({
    url: '/admin/login/doRegister',
    method: 'post',
    params: {
      username,
      password,
    },
  });
}

export function getInfo(token) {
  return request({
    url: `/admin/user/info/${token}`,
    method: 'get',
    params: { token },
  });
}

export function logout() {
  return request({
    url: '/admin/login/logout',
    method: 'post',
  });
}
export function delUser(params) {
  return request({
    url: `/admin/user/doDeleteUser/${params}`,
    method: 'delete',
  });
}

export function getUserList(params) {
  return request({
    url: '/admin/user/doQueryUser',
    method: 'post',
    data: params,
  });
}

export function getUserById(params) {
  return request({
    url: `/admin/user/doQueryUserById/${params}`,
    method: 'get',
  });
}

export function doEditUser(params) {
  return request({
    url: '/admin/user/doEditUser',
    method: 'put',
    data: params,
  });
}
